package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.StrategySunComment;
import cn.wolfcode.trip.base.mapper.StrategySunCommentMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IStrategyCommentService;
import cn.wolfcode.trip.base.service.IStrategySunCommentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StrategySunCommentImpl implements IStrategySunCommentService {
    @Autowired
    private StrategySunCommentMapper sunCommentMapper;


    @Override
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<StrategySunComment> list = sunCommentMapper.selectForList(qo);
        return new PageInfo<>(list);
    }

    @Override
    public void save(StrategySunComment sunComment) {
        sunCommentMapper.insert(sunComment);
    }

    @Override
    public PageInfo queryForAddMe(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<StrategySunComment> list = sunCommentMapper.selectForAddMe(qo);
        return new PageInfo<>(list);
    }

    @Override
    public StrategySunComment selectSunCommentById(Long id) {
        return sunCommentMapper.selectByPrimaryKey(id);
    }
}
